#!/usr/bin/python3
# -*- coding: utf-8 -*-
import yaml
import random
import time


def writeYaml(token, uid, suid, code_id):
    f = open('/wangzhijing/jenkins/retail/testFile/data.yml', encoding='utf-8')
    data = yaml.load(f, Loader=yaml.FullLoader)
    data['data']['token'] = token
    data['data']['uid'] = uid
    data['routes']['首页接口']['正扫']['suid'] = suid
    data['routes']['首页接口']['正扫']['code_id'] = code_id
    data['routes']['首页接口']['反扫']['suid'] = suid
    data['routes']['首页接口']['反扫']['code_id'] = code_id
    data['routes']['首次报件流程']['查询门店收银点是否绑定台卡']['suid'] = suid
    data['routes']['首次报件流程']['查询门店收银点是否绑定台卡']['code_id'] = code_id
    data['routes']['首次报件流程']['绑定台卡']['suid'] = suid
    data['routes']['首次报件流程']['绑定台卡']['code_id'] = code_id
    data['routes']['首次报件流程']['获取报件邀请二维码']['shop_sub_id'] = suid
    data['routes']['门店管理']['修改我的门店']['shop_sub_id'] = suid
    data['routes']['员工管理']['获取门店下的所有收银点']['shop_sub_id'] = suid
    data['routes']['收银点管理']['更改收银点名称']['code_id'] = code_id
    data['routes']['收银点管理']['更改收银点名称']['name'] = random.randrange(99, 9999)
    data['routes']['收银点管理']['添加收银点']['shop_sub_id'] = suid
    data['routes']['收银点管理']['添加收银点']['code_name'] = random.randrange(99, 9999)
    data['routes']['营销奖励']['查看营销奖励获取记录']['lastday'] = time.strftime("%Y-%m-%d")
    data['routes']['营销奖励']['查看营销奖励获取详情记录']['start_days'] = time.strftime("%Y-%m-%d")
    data['routes']['营销奖励']['查看营销奖励获取详情记录']['lastday'] = time.strftime("%Y-%m-%d")
    data['routes']['硬件管理']['获取门店硬件设备列表']['shop_sub_id'] = suid
    data['routes']['硬件管理']['夜猫货柜详情']['shop_sub_id'] = suid
    data['routes']['硬件管理']['购买硬件获取支付链接']['shop_sub_id'] = suid
    data['routes']['硬件管理']['购买硬件获取支付链接']['code_id'] = code_id
    data['routes']['订单管理']['账本列表']['start_time'] = time.strftime("%Y-%m-%d")
    data['routes']['值班管理']['值班明细']['shop_sub_id'] = suid
    data['routes']['值班管理']['值班明细']['begintime'] = time.strftime("%Y-%m-%d")
    data['routes']['值班管理']['值班明细']['endtime'] = time.strftime("%Y-%m-%d")
    data['routes']['值班管理']['我要值班收银点列表']['suid'] = suid
    data['routes']['值班管理']['收银员上下班接口']['suid'] = suid
    data['routes']['值班管理']['收银员上下班接口']['code_id'] = code_id
    data['routes']['设置']['设置门店播报开关']['suid'] = suid
    data['routes']['订阅管理']['动态列表']['suid'] = suid
    data['routes']['订阅管理']['删除/恢复动态']['suid'] = suid
    data['routes']['订阅管理']['回收站列表']['suid'] = suid
    data['routes']['订阅管理']['动态评论列表']['suid'] = suid
    data['routes']['订阅管理']['动态点赞列表']['suid'] = suid
    data['routes']['订阅管理']['订阅统计']['suid'] = suid
    data['routes']['订阅管理']['订阅统计']['start_time'] = time.strftime("%Y-%m-%d")
    data['routes']['订阅管理']['订阅统计']['end_time'] = time.strftime("%Y-%m-%d")
    data['routes']['订阅管理']['订阅列表']['suid'] = suid
    data['routes']['订阅管理']['订阅列表']['start_time'] = time.strftime("%Y-%m-%d")
    data['routes']['订阅管理']['订阅列表']['end_time'] = time.strftime("%Y-%m-%d")
    data['routes']['收银点绑定台卡接口']['收银点绑定台卡接口']['shop_sub_id'] = suid
    data['routes']['收银点绑定台卡接口']['收银点绑定台卡接口']['code_id'] = code_id
    data['routes']['收银点绑定台卡接口']['收银点列表接口']['shop_sub_id'] = suid
    f = open('/wangzhijing/jenkins/retail/testFile/data.yml', 'w', encoding='utf-8')
    yaml.dump(data, f, allow_unicode=True, encoding='utf-8', default_flow_style=False, sort_keys=False)
